import { RouteRecordRaw } from 'vue-router';
import { Layout } from '@/router/constant';
import { FileDoneOutlined } from '@vicons/antd';
import { renderIcon } from '@/utils/index';

/**
 * @param name 路由名称, 必须设置,且不能重名
 * @param meta 路由元信息（路由附带扩展信息）
 * @param redirect 重定向地址, 访问这个路由时,自定进行重定向
 * @param meta.disabled 禁用整个菜单
 * @param meta.title 菜单名称
 * @param meta.icon 菜单图标
 * @param meta.keepAlive 缓存该路由
 * @param meta.sort 排序越小越排前
 *
 * */
const routes: Array<RouteRecordRaw> = [
  {
    path: '/tenant',
    name: 'tenant',
    redirect: '/tenant/info',
    component: Layout,
    meta: {
      title: '租户管理',
      icon: renderIcon(FileDoneOutlined),
      sort: 3,
      permissions: ['tenant_list','tenant_info','tenant_dept','base_sys_tenant_info'],
    },
    children: [
      {
        path: 'list',
        name: 'tenant_list',
        meta: {
          title: '租户列表',
          permissions: ['tenant_list'],
        },
        component: () => import('@/views/tenant/list/tenantList.vue'),
      },
      {
        path: 'tenant-detail/:id?',
        name: 'tenant-detail',
        meta: {
          title: '租户详情',
          hidden: true,
          activeMenu: 'tenant-detail',
          permissions: ['base_sys_tenant_info'],
        },
        component: () => import('@/views/tenant/list/tenantInfo.vue'),
      },
      {
        path: 'info',
        name: 'tenant_info',
        meta: {
          title: '企业信息',
          permissions: ['tenant_info'],
        },
        component: () => import('@/views/tenant/info/currentTenant.vue'),
      },
      {
        path: 'dept',
        name: 'tenant_dept',
        meta: {
          title: '部门管理',
          permissions: ['tenant_dept'],
        },
        component: () => import('@/views/tenant/dept/dept.vue'),
      },
      {
        path: 'config',
        name: 'tenant_config',
        meta: {
          title: '配置管理',
          permissions: ['tenant_config'],
        },
        component: () => import('@/views/tenant/config/tenantConfig.vue'),
      },
      {
        path: 'positionCode',
        name: 'tenant_positionCode',
        meta: {
          title: '职位代码',
          permissions: ['tenant_positionCode'],
        },
        component: () => import('@/views/tenant/position/positionCode.vue'),
      },
      {
        path: 'position',
        name: 'tenant_position',
        meta: {
          title: '职位管理',
          permissions: ['tenant_position'],
        },
        component: () => import('@/views/tenant/position/position.vue'),
      },
    ],
  },
];

export default routes;
